package com.example.film.controller;

import com.example.film.entity.Top250Film;
import com.example.film.service.Top250FilmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "top250电影信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("top250/v1")
public class Top250FilmController {
    @Autowired
    private Top250FilmService top250FilmService;

    @ApiOperation("top250电影信息")
    @GetMapping("/films")
    public List<Top250Film> getTop250Film(){
        return top250FilmService.findTop250Film();
    }

    @ApiOperation("分页查询top250电影信息")
    @GetMapping("/film")
    public List<Top250Film> getTop250FilmInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return top250FilmService.findTop250FilmInfo(pageNum, pageSize);
    }
}
